#include <iostream>
#include <utility>
#include <climits>
#include <vector>
#include <algorithm>

using namespace std;

pair<int,int> SumTONumber(vector<int> & v, int k) {
	int i = 0, j = v.size() - 1;
	while (i < j) {
		if (v[i] + v[j] == k)
			return make_pair(v[i], v[j]);
		else if (v[i] + v[j] < k)
			i++;
		else
			j--;
	}

	return make_pair(INT_MIN, INT_MIN);
}

int main()
{
	vector<int> vec;
	for (int i = 1; i < 1000; ++i)
		vec.push_back(rand()%10);
	
	sort(vec.begin(), vec.end());

	int k;
	while(cin >> k)	{
		pair<int,int> p = SumTONumber(vec, k);
		if (p.first > INT_MIN)
			cout << p.first << " " << p.second << endl;
	}

	return 0;
}
